package com.yy.job.common.utils;

public class BaseResult<T> {
	
	private boolean success = false;
	
	private String code;
	
	private String message;
	
	private T result;
	
	public BaseResult() {
		
	}
	
	public BaseResult(boolean success, String code, String message, T result) {
		super();
		this.success = success;
		this.code = code;
		this.message = message;
		this.result = result;
	}
	
	public static <E> BaseResult<E> success(E result) {		
		return new BaseResult<E>(true, "0", null, result);
	}
	
	public static BaseResult fail(String code, String message) {
		return new BaseResult(false, code, message, null);
	}

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public T getResult() {
		return result;
	}

	public void setResult(T result) {
		this.result = result;
	}
	
}
